<template>
  <view class="my-search-container" :style="{'background': bgcolor}">
    <view class="my-search-box" :style="{'border-radis':radius + 'px'}" @click="searchBoxHandler()"> 
      <icon type="search" size="17"></icon>
      <text class="placeholder">搜索</text>
    </view>
  </view>
</template>

<script>
  export default {
    name:"my-search",
    data() {
      return {
        
      };
    },
    props:{
      bgcolor:{
        type:String,
        default:'#c00000'
      },
      radius:{
        type:Number,
        default:20
      }
    },
    methods:{
      //模拟input点击
      searchBoxHandler(){
        this.$emit('click')
      }
    }
  }
</script>

<style lang="scss">
  .my-search-container{
  background-color: #c00000;
  height: 50px;
  padding: 0 10px;
  display: flex;
  align-items: center;
  .my-search-box{
    display: flex;
    height: 36px;
    border-radius: 15px;
    width: 100%;
    align-items: center;
    justify-content: center;
    background-color: #fff;
    
    .placeholder{
      font-size: 18px;
      margin-left: 5px;
      color: rgb(185,185,185);
    }
  }
  }
      
      
</style>